﻿using UnityEngine;
using System.Collections;

public abstract class IAction
{
    protected readonly OwnerObj ownerObj;

    public IAction(OwnerObj ownerObj)
    {
        this.ownerObj = ownerObj;
    }

    public virtual void Start()
    {
        if (null != ownerObj)
        {
            ownerObj.Get<IUnitObject>().GetModule().Get<ModAction>().PutOnAction(this);
        }
    }

    /// <summary>
    /// 开始
    /// </summary>
    public abstract void Load();

    /// <summary>
    /// 开始
    /// </summary>
    public abstract void Unload();

    /// <summary>
    /// 中断
    /// </summary>
    public abstract void Interrupt();

    /// <summary>
    /// 是否可以中断
    /// </summary>
    /// <returns></returns>
    public abstract bool IsCanInterrupt(IAction nextAction);

    /// <summary>
    /// 更新
    /// </summary>
    /// <param name="deltaTime"></param>
    public abstract void Update(float deltaTime);

    /// <summary>
    /// 是否已经结束
    /// </summary>
    /// <returns></returns>
    public abstract bool IsFinished();
}
